<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<style type="text/css">
    input.error, select.error, textarea.error{border: 1px solid #CC0000;}
</style>

<link type="text/css" href="<html:rewrite page='/css/ui-lightness/jquery-ui-1.8.10.custom.css'/>" rel="stylesheet" />
<script language='javascript' type="text/javascript" src="<html:rewrite page='/script/jquery-1.5.1.js'/>"></script>
<script language='javascript' type="text/javascript" src="<html:rewrite page='/script/jquery.maskedinput-1.2.2.js'/>"></script>
<script language='javascript' type="text/javascript" src="<html:rewrite page='/script/jquery-ui-1.8.10.custom.min.js'/>"></script>
<script language='javascript' type="text/javascript" src="<html:rewrite page='/script/jquery.ui.datepicker-es.js'/>"></script>
<script language='javascript' type="text/javascript" src="<html:rewrite page='/script/recreacional.js'/>"></script>

<html:form action="/SolicitudAsamblea.do" onsubmit="return validateForm();">

    <input type="hidden" name="method" value="guardar"/>
    <TABLE style="WIDTH: 100%">
        <TBODY>
            <TR>
                <TD class=espacio_titulo_barra></TD></TR>
            <TR>
                <TD>
                    <DIV>
                        <TABLE width="100%">
                            <TBODY>
                                <TR>
                                    <TD style="HEIGHT: 40px"><SPAN
                                            id=ctl00_cphCuerpo_lbltitulo class=titulo>Registrar  Solicitud de Asamblea</SPAN>
                                        <HR>
                                    </TD></TR>
                                <TR>
                                    <TD></TD></TR>
                                <TR>
                                    <TD>

                                        <TABLE cellSpacing=0 cellPadding=2 width="100%" align=center>
                                            <TBODY>
                                                <TR>
                                                    <TD colSpan=2>
                                                        <DIV style="DISPLAY: none; COLOR: red"
                                                             id=ctl00_cphCuerpo_SummaryValidation></DIV></TD></TR>
                                                <TR>
                                                    <TD width="10%">Descripci&oacute;n:</TD>
                                                    <TD>
                                                        <html:text style="WIDTH: 350px" maxlength="50" styleClass="stl_texbox" property="bean.descripcion" />
                                                        <SPAN
                                                            style="VISIBILITY: hidden; COLOR: red"
                                                            id=ctl00_cphCuerpo_RequiredNombre>*</SPAN></TD></TR>
                                                <TR>
                                                    <TD>Fecha:</TD>
                                                    <TD>
                                                        <html:text styleId="datepicker" maxlength="25" property="bean.fecha" readonly="true"/>
                                                        <SPAN
                                                            style="VISIBILITY: hidden; COLOR: red"
                                                            id=ctl00_cphCuerpo_RequiredNombre0>*</SPAN></TD></TR>
                                                <TR>
                                                    <TD>Hora:</TD>
                                                    <TD>
                                                        <html:text style="WIDTH: 123px" styleId="hora" property="bean.hora" onblur="valida(this.value);"/>
                                                        <SPAN
                                                            style="VISIBILITY: hidden; COLOR: red"
                                                            id=ctl00_cphCuerpo_RequiredNombre1>*</SPAN></TD></TR>
                                                <TR>
                                                    <TD>Tipo Asamblea:</TD>
                                                    <TD>
                                                        <html:select property="bean.tipo" styleClass="stl_texbox">
                                                            <html:option value="1"><bean:message key="asamblea.tipo.1" bundle="LabelResources" /></html:option>
                                                            <html:option value="2"><bean:message key="asamblea.tipo.2" bundle="LabelResources" /></html:option>
                                                        </html:select>
                                                    </TD>
                                                </TR>
                                            </TBODY></TABLE>



                                    </TD></TR>
                                <TR>
                                    <TD style="HEIGHT: 30px" vAlign=bottom align="center">

                                        <html:submit styleId="ctl00_cphCuerpo_btnNuevo" value="Aceptar"/>
                                        <INPUT id=ctl00_cphCuerpo_btnNuevo value="Atr&aacute;s" type=button name=ctl00$cphCuerpo$btnNuevo onClick="window.location = '<html:rewrite action="/SolicitudAsamblea.do"/>'">
                                    </TD>
                                </TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE>
                            </html:form>


<script type="text/javascript">

    function validateForm(){
        var objForm = document.forms["SolicitudAsambleaForm"];
        var msg = "";
        hasError = false;
        for(i=0; i<objForm.elements.length; i++){
            removeClass(objForm.elements[i],"error");
        }

        if(isEmpty(objForm['bean.descripcion'].value)) {
            msg += appendError(objForm['bean.descripcion'],"Descripcion","es requerida");
        }

        if(isEmpty(objForm['bean.fecha'].value)) {
            msg += appendError(objForm['bean.fecha'],"Fecha","es requerida");
        }

        if(isEmpty(objForm['bean.hora'].value)) {
            msg += appendError(objForm['bean.hora'],"Hora","es requerida");
        }

        if(isEmpty(objForm['bean.tipo'].value)) {
            msg += appendError(objForm['bean.tipo'],"Tipo","es requerido");
        }

        if(msg!=""){
            alert(msg);
            return false;
        }
        else{
            return true;
        }
    }

</script>


<script type="text/javascript">
    $(function(){
        // Datepicker
        $('#datepicker').datepicker({
            inline: true
        });
    });
</script>

<script type="text/javascript">
    jQuery(function($){
        $.mask.definitions['H']='[012]';
        $.mask.definitions['N']='[012345]';
        $.mask.definitions['n']='[0123456789]';
        $.mask.definitions['z']='[0123]';
        $("#hora").mask("Hn:Nn");
    });

    function valida(valor)
    {
        //que no existan elementos sin escribir
        if(valor.indexOf("_") == -1)
        {
            var hora = valor.split(":")[0];
            if(parseInt(hora) > 23 )
            {
                $("#hora").val("");
            }
        }
    }
</script>